package main;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import draw.StdDraw;

import file_import.In;

public class Fast {
	
    public static Point[] pointArr;
    public static Set<Point[]> collinearPointsSet = new HashSet<Point[]>();
    
	public static void main(String[] args) {
        StdDraw.setXscale(0, 32768);
        StdDraw.setYscale(0, 32768);
        Fast fast = new Fast();
//        fast.readPointsFromFile("collinear/input50.txt");
//        fast.readPointsFromFile("collinear/grid4x4_a.txt");
        fast.readPointsFromFile("collinear/input6.txt");
        printSlopes(pointArr);
        Arrays.sort(pointArr, pointArr[0].SLOPE_ORDER);
        printSlopes(pointArr);
	}

    private static void printSlopes(Point[] p) {
//    	for (int i = 0; i < p.length; i++) {
//    		System.out.println(p[i]);    			
//    	}
    	for (int i = 0; i <= p.length-2; i++) {
    		System.out.println(p[i].slopeTo(p[i+1]));
    	}
    	System.out.println();
    }
	
    public void readPointsFromFile(String filename) {
        String f = filename;
        In in = new In(f);
        int N = in.readInt();
        pointArr = new Point[N];
        for (int i = 0; i < N; i++) {
            int x = in.readInt();
            int y = in.readInt();
            Point p = new Point(x, y);
            pointArr[i] = p;
            p.draw();
        }
    }
}
